package com.amos.knife4j.config.result;

/**
 * 枚举：返回码-->返回信息，主要用户返回信息
 *
 * @author wang_dgang
 * @since 2018-10-22 15:51:57
 */
public enum ResultEnums implements RestInterface {
    // 常用信息
    ERROR(-1, "请求错误"),
    FAILED(0, "请求失败"),
    SUCCESS(1, "请求成功"),
    REPEAT(2, "不能重复提交"),
    // 请求错误相关
    ERR_ADD(0, "添加失败"),
    ERR_UPDATE(0, "修改失败"),
    ERR_DELETE(0, "删除失败"),
    ERR_QUERY(0, "查询失败"),
    ERR_SETTING(0, "设置失败"),
    ERR_SEND(0, "发送失败"),
    ERR_CHECK(0, "证码失败"),
    // 请求成功相关
    SUCC_ADD(1, "添加成功"),
    SUCC_UPDATE(1, "修改成功"),
    SUCC_DELETE(1, "删除成功"),
    SUCC_QUERY(1, "查询成功"),
    SUCC_SETTING(1, "设置成功"),
    SUCC_SEND(1, "发送成功"),
    SUCC_CHECK(1, "验证成功"),
    OBJECT_NOT_EXISTS(0, "查询对象不存在"),
    // 常用请求错误码，主要用于WebInterceptor请求拦截
    ERR_400(400, "请求无效"),
    ERR_401(401, "未授权"),
    ERR_403(403, "禁止访问 "),
    ERR_404(404, "请求不存在"),
    ERR_405(405, "请求类型错误"),
    ERR_500(500, "服务器错误"),
    ERR_502(502, "错误网关"),
    ERR_503(503, "无法获得服务"),

    //通用错误码
    LOGIN_FAILURE(10, "用户登录失效"),


    ;
    // 状态码
    private int code;
    // 返回信息
    private String msg;

    ResultEnums(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    @Override
    public int getCode() {
        return code;
    }

    @Override
    public String getMsg() {
        return msg;
    }
}
